package com.liangzai.适配器模式.service.adapter;

import java.util.HashMap;
import java.util.List;

/**
 * @author leiliang
 * @version 1.0
 * @Description 适配器 将map通过适配转换为list
 * @date 2021/10/29 15:02
 */
public class ListAdapter extends HashMap {

    //目标对象
    private List list;

    public ListAdapter(List list) {
        this.list = list;
    }

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public Object get(Object key) {
        return list.get(Integer.valueOf(key.toString()).intValue());
    }
}
